/*
 *
 * @Date: 2022-06-18 22:12:04
 * @LastEditTime: 2022-06-19 00:00:30
 * @LastEditors:
 */
import {Component, OnInit} from '@angular/core';
import {ApiPath} from '../../config/api-path';
import {HttpService} from '../../service/http.service';
import {Announce} from '../../model/announce';
import { Router, RouteConfigLoadStart, NavigationEnd } from '@angular/router';


@Component({
  selector: 'app-announce-container',
  templateUrl: './announce-container.component.html',
  styleUrls: ['./announce-container.component.scss'],
})
export class AnnounceContainerComponent implements OnInit {
  thumbStyle = {
    width: '50px',
    height: '50px',
  };
  listData: Announce[];

  constructor(
    private HttpSrv: HttpService,
    private router: Router,
  ) {
  }

  adminHeadImg: string = ApiPath.ADMIN_IMG_PATH;

  ngOnInit() {
    this.initi();
  }

  initi() {
    this.HttpSrv.httpGet<Announce[]>(ApiPath.request.announce.recentBulletins)
      .subscribe(res => {
        if ('data' in res) {
          this.listData = res.data;
          console.debug(this.listData);
        }
      });
  }
  linkTo(index) {
    // this.router.navigateByUrl()
    this.router.navigate(['/detail',  index]);
  }
}
